import { IFeidaoAiBrowserComponent } from '@feidao/web/interfaces';
import get_certifi_type_data from '../atom/get-certifi-type-data';
import { anim, play } from '@feidao/animation';
import render from "@feidao/web/atom/browser/render/render";
import nodejs from "@feidao/web/atom/browser/msg/nodejs";
import P01 from './P01';
import P02 from './P02';

export default async function a004(fd: IFeidaoAiBrowserComponent, ...args: any[]) {
	// 调用事件
	const id = args[0][0];
	fd.data.id = id;
	play(anim(fd.data.node, {}, {
		right: {
			start: -1100,
			end: 0
		}
	}));
	const data = await nodejs(fd.data.spaceid, 'certifi_info_detail', { _id: id });
	render(fd, data, P01, 'P01', 'inner');

	// 获取 证照类型 数据
	const type_data = await get_certifi_type_data(fd, {});
	render(fd, type_data, P02, 'P02', 'replace');


	// 设置证照类型的值

	const f = fd.data.node.querySelector<HTMLFormElement>('#certifi_info_update_form');
	f.no.value = data.no;
}
